home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* */
- /* Calculate total size of files in Aminet index */
- /* */
- /* P-O Yliniemi (P-O_Yliniemi@spectre.talshiar.pp.se) */
- /* */
- /* 13-Jun-95 */
- /* */
- /* Place the cursor at the beginning of the first line to include in */
- /* the calculation before executing this script! */
- /* */
- /* The script is written for Edge v1.70, but can easily be changed to */
- /* work with most other editors (that supports ARexx, of course). */
- /* */
- /* If Edge crashes while executing this script, try to increase Edge's */
- /* stack size (crashed twice with stack size of 40K, but works fine */
- /* when I increased it to 640K). */
- /* */
- /************************************************************************/
-
- options results
-
- GetEnvVar _FE_Lines /* Get number of lines in index */
- numfiles=result
- GetEnvVar _WE_Line /* Get current line number */
- numfiles=numfiles-result-1 /* Calculate number of files */
-
- totalsize=0 ; realfiles=0 /* Reset result variables */
-
- do numfiles
- GoToColumn 32 /* Go to the size column */
-
- GetEnvVar _WE_Column /* Get current column number */
- if result=31 then do /* Go to next line if on an empty */
- MarkBlock ; Cursor Right 4 /* Mark the size */
- sizemult=1 /* Number to multiply size with */
- GetEnvVar _WE_ASCII /* Get ASCII code for current char */
- if result=77 then sizemult=1024 /* Multiply 'M' with 1024 to get 'K'*/
- if result~=63 then do /* Exit if no specified size */
- Cursor Left 0 /* Move one char back to skip 'K' */
- Copy RB /* Copy to result buffer */
- size=result*sizemult /* Save size */
- totalsize=totalsize+size /* Add to total */
- end
- realfiles=realfiles+1 /* Increment file counter */
- BlockOff /* Turn off block mode */
- end
- Cursor Down 1 /* Move to next filename */
- end
- 'RequestNotify "Total size of 'realfiles' files: 'totalsize'K = 'TRUNC(totalsize/1024,1)'M"'
-